package com.example.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class RedisMain {

    @Autowired
    private StringRedisTemplate redisTemplate;


    public Object get(String key){
        Object test = redisTemplate.boundValueOps(key).get();
        return test;
    }

    public Object lpop(String key){
        String s = redisTemplate.boundListOps(key).leftPop(100, TimeUnit.SECONDS);
        return s;
    }

    public void push(String key,String o){
        Long aLong = redisTemplate.boundListOps(key).leftPush(o);
    }


}
